home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / 422mods.zip / BENNY3.422 < prev    next >
Text File  |  1993-03-31  |  13KB  |  469 lines

  1. Welcome to BENNY3.MOD!  This is the File listing in a Box modification.
  2. by: Benny Hill
  3.     (Joseph Rybaczek)
  4. v1.0 released
  5. v1.1 - Minor bug fix, Find Description Function did not complete
  6.        box when switching dirs.
  7. v1.2 - (UNOFFICIAL) Edited without authorization to be compatible with
  8.                 WWIV4.20 By Byte of The Abyss
  9. v1.3 - (Another UNOFFICIAL) Edit without authorization to be compatible with
  10.              WWIV4.22 By Byte of The Abyss: WWIVNet-1@7454;
  11.  
  12.     I got this idea a long time ago, when The White Star Line BBS
  13. was up some time ago, The Captain had a filelisting that was in a nice
  14. box, that I thought was good.  Unfortunately, I couldn't figure out how
  15. to do it, as I was new to WWIV Source, and "c" in general.
  16.     Quite recently, someone released a modification that did a
  17. listing that was almost similar, but was not exactly what I wanted, so,
  18. I toyed around with the code, kept working on it, did some graphing,
  19. and started doing it.  After about 4 hours of coding, I finally got it
  20. completely working!  The Results were great, as far as I was concerned!
  21.     Now, I have my file listings in a box, in such a way where
  22. NON-ANSI users get a listing somewhat like:
  23.  
  24. Area: Miscellaneous - 1
  25.  
  26. +---------------------------------------------------------------------------+
  27. : Filename.Ext : Size  : Description                       Total Files:   3 :
  28. +--------------+-------+----------------------------------------------------+
  29. : AFILE   .ZIP :   20k : This file is a neat little file                    :
  30. : BOARDLST.ZIP :    3k : This file is an even neater little file            :
  31. : CALLTHIS.ZIP :   15k : This file is a complete listing of all BBS's in    :
  32. :                        Tim-Buk-tu, the BBSing capital of the world as we  :
  33. :                        know it today!  a great listing!                   :
  34. : DUMBFILE.ZIP :  148k : A Dumb file that is here, etc....                  :
  35. +--------------+-------+----------------------------------------------------+
  36.  
  37. Ansi users get color (if extended colors on) and EXTENDED Ansi
  38. Characters as the box...  It looks real nice!  It is a nice addition
  39. to your transfer area!
  40.  
  41.     DISCLAIMER:  Use of this modification is at your own risk.  I
  42. only offer my personal affirmation that this modification works on my
  43. system with no problems.  So, If this modification destroys your BBS,
  44. Crashes your computer, kills your Grandma, the dog, makes your car break
  45. down, etc, don't come complaining here....  if you find a bug, let me
  46. know about it, though!!!
  47.     Anyway, the installation....
  48. Load up XFER.C, remove or comment out the routine void print_extended
  49. and replace it with this routine....
  50.  
  51. void print_extended(char *fn, int *abort, unsigned char numlist, int indent)
  52. {
  53.   char *ss;
  54.   int next=0;
  55.   unsigned char numl=0;
  56.   int cpos=0;
  57.   char ch,s[81];
  58.   int i,fc;
  59.  
  60.   fc=thisuser.sysstatus & sysstatus_funky_colors;
  61.  
  62.   ss=read_extended_description(fn);
  63.   if (ss) {
  64.     ch=10;
  65.     while ((ss[cpos]) && (!(*abort)) && (numl<numlist)) {
  66.       if ((ch==10) && (indent)) {
  67.     if (okansi()) {
  68.       if (fc)
  69.         sprintf(s,"3│\x1b[%dC1",INDENTION);
  70.       else
  71.         sprintf(s,"│\x1b[%dC",INDENTION);
  72.     } else {
  73.       outstr(":");
  74.       for (i=0; i<INDENTION; i++)
  75.         s[i]=32;
  76.       s[INDENTION]=0;
  77.     }
  78.     osan(s,abort,&next);
  79.       }
  80.       ch=ss[cpos++];
  81.       if ((ch==13) && (indent)) {
  82.        while (!(wherex()>=77))
  83.       outstr(" ");
  84.        if (okansi()) {
  85.      if (fc)
  86.        outstr("3│");
  87.      else
  88.      outstr("│");
  89.        } else
  90.      outstr(":");
  91.       }
  92.       outchr(ch);
  93.       checka(abort,&next);
  94.       if (ch==10)
  95.     ++numl;
  96.       else {
  97.     if ((ch!=13) && (wherex()>=77)) {
  98.     while (!(wherex()>=77))
  99.       outstr(" ");
  100.       if (fc)
  101.         ansic(3);
  102.       if (okansi())
  103.         outstr("│");
  104.       else
  105.         outstr(":");
  106.       osan("\r\n",abort,&next);
  107.       ch=10;
  108.     }
  109.       }
  110.     }
  111.     if (wherex())
  112.       nl();
  113.   }
  114.   farfree(ss);
  115. }
  116. Next, remove or comment out void printinfo and void printtitle, and
  117. replace them with my routines....
  118.  
  119. void printinfo(uploadsrec *u, int *abort)
  120. {
  121.   char s[85],s1[40],s2[81];
  122.   int i,next,fc;
  123.  
  124.   fc=thisuser.sysstatus & sysstatus_funky_colors;
  125.  
  126.   if (fc)
  127.     ansic(3);
  128.   if (okansi())
  129.     strcpy(s,"│ ");
  130.   else
  131.     strcpy(s,": ");
  132.   osan(s,abort,&next);
  133.   strncpy(s,u->filename,8);
  134.   s[8]=0;
  135.   if (fc)
  136.     ansic(2);
  137.   osan(s,abort,&next);
  138.   strncpy(s,&((u->filename)[8]),4);
  139.   s[4]=0;
  140.   if (fc)
  141.     ansic(2);
  142.   osan(s,abort,&next);
  143.   if (fc)
  144.     ansic(3);
  145.   if (okansi())
  146.     osan(" │ ",abort,&next);
  147.   else
  148.     osan(" : ",abort,&next);
  149.  
  150.   ltoa((((u->numbytes)+1023)/1024),s1,10);
  151.   strcat(s1,"k");
  152.  
  153. #ifdef CHECK_FOR_EXISTANCE
  154.   strcpy(s2,directories[udir[curdir].subnum].path);
  155.   strcat(s2,u->filename);
  156.   if (!exist(s2))
  157.     strcpy(s1,"N/A");
  158. #endif
  159.  
  160.   for (i=0; i<5-strlen(s1); i++)
  161.     s[i]=32;
  162.   s[i]=0;
  163.   strcat(s,s1);
  164.   if (fc)
  165.     ansic(5);
  166.   osan(s,abort,&next);
  167.  
  168.   if (fc)
  169.     ansic(3);
  170.   if (okansi())
  171.     osan(" │ ",abort,&next);
  172.   else
  173.     osan(" : ",abort,&next);
  174.   if (fc)
  175.     ansic(1);
  176.   if (okansi())
  177.     if (fc)
  178.       sprintf(s,"%-51.51s 3│",u->description);
  179.     else
  180.       sprintf(s,"%-51.51s │",u->description);
  181.   else
  182.     sprintf(s,"%-51.51s :",u->description);
  183.   pla(s,abort);
  184.   if ((!*abort) && (thisuser.num_extended) && (u->mask & mask_extended))
  185.   print_extended(u->filename,abort,thisuser.num_extended,1);
  186.   if (!(*abort))
  187.     ++num_listed;
  188. }
  189. void printtitle(int *abort)
  190. {
  191.   char s[81],s1[20],s2[101];
  192.   int i,i1,fc;
  193.  
  194.   fc=thisuser.sysstatus & sysstatus_funky_colors;
  195.  
  196.   nl();
  197.   nl();
  198.   npr("7Area %s - %s\r\n0",directories[udir[curdir].subnum].name,
  199.   udir[curdir].keys);
  200.  
  201.  
  202.   nl();
  203.   if (okansi()) {
  204.     if (fc)
  205.       ansic(3);
  206.     pla("┌──────────────┬───────┬─────────────────────────────────────────────────────┐",abort);
  207.     if (fc)
  208.       sprintf(s2,"3│ 2Filename.Ext 3│ 5Size 3 │ 1Description                      Total Files:   %3d 3│",numf);
  209.     else
  210.       sprintf(s2,"│ Filename.Ext │ Size  │ Description                      Total Files:   %3d │",numf);
  211.     pla(s2,abort);
  212.     if (fc)
  213.       ansic(3);
  214.     pla("├──────────────┼───────┼─────────────────────────────────────────────────────┤",abort);
  215.   } else {
  216.     pla("+--------------+-------+-----------------------------------------------------+",abort);
  217.     sprintf(s2,": Filename.Ext : Size  : Description                      Total Files:   %3d :",numf);
  218.     pla(s2,abort);
  219.     pla("+--------------+-------+-----------------------------------------------------+",abort);
  220.   }
  221. }
  222. Now, search for void listfiles() and void nscandir(....  Remove or
  223. comment them out, and replace with my routines.
  224.  
  225. void listfiles(void)
  226. {
  227.   char s[81];
  228.   int i,abort,fc;
  229.   uploadsrec u;
  230.  
  231.   fc=thisuser.sysstatus & sysstatus_funky_colors;
  232.   dliscan();
  233.   file_mask(s);
  234.   abort=0;
  235.   num_listed=0;
  236.   printtitle(&abort);
  237.   for (i=1; (i<=numf) && (!abort) && (!hangup); i++) {
  238.     SETREC(i);
  239.     read(dlf,(void *)&u,sizeof(uploadsrec));
  240.     if (compare(s,u.filename))
  241.       printinfo(&u,&abort);
  242.   }
  243.   closedl();
  244.   if (!abort) {
  245.    if (fc)
  246.      ansic(3);
  247.    if (okansi())
  248.      pla("└──────────────┴───────┴─────────────────────────────────────────────────────┘",&abort);
  249.    else
  250.        pla("+--------------+-------+-----------------------------------------------------+",&abort);
  251.       nl();
  252.  
  253.       sprintf(s,"3[ 2Files listed:1 %d",num_listed);
  254.       outstr(s);
  255.       pl(" 3]");
  256.   nl();
  257.  }
  258. }
  259. void nscandir(int d, int *abort,int title)
  260. {
  261.   int i,od,dt,fc,pc;
  262.   uploadsrec u;
  263.   char s[81];
  264.  
  265.   fc=thisuser.sysstatus & sysstatus_funky_colors;
  266.   od=curdir;
  267.   curdir=d;
  268.   dt=title;
  269.   pc=0;
  270.   dliscan();
  271.   for (i=1; (i<=numf) && (!(*abort)) && (!hangup); i++) {
  272.     SETREC(i);
  273.     read(dlf,(void *)&u,sizeof(uploadsrec));
  274.     if (u.daten>=nscandate) {
  275.       if (dt) {
  276.     printtitle(abort);
  277.     dt=0;
  278.     pc=1;
  279.       }
  280.       printinfo(&u,abort);
  281.     }
  282.   }
  283.   if ((pc) && (!(*abort))) {
  284.     if (fc)
  285.       ansic(3);
  286.     if (okansi())
  287.       pl("└──────────────┴───────┴─────────────────────────────────────────────────────┘");
  288.     else
  289.       pl("+--------------+-------+-----------------------------------------------------+");
  290.     nl();
  291.     pc=0;
  292.   }
  293.   closedl();
  294.   curdir=od;
  295. }
  296. Next, find, comment out or replace void searchall() with this
  297. routine....
  298. void searchall(void)
  299. {
  300.   int i,i1,pts,abort,pty,ocd,pc,fc,next=0;
  301.   char s[81],s1[81];
  302.   uploadsrec u;
  303.  
  304.     fc=thisuser.sysstatus & sysstatus_funky_colors; 
  305.   abort=0;
  306.   ocd=curdir;
  307.   if (x_only) {
  308.     strcpy(s,"*.*");
  309.     align(s);
  310.   } else {
  311.     nl();
  312.     nl();
  313.     pl(get_string(745));
  314.     file_mask(s);
  315.   }
  316.   num_listed=0;
  317.   for (i=0; (i<num_dirs) && (!abort) && (!hangup) && (udir[i].subnum!=-1); i++) {
  318.     i1=udir[i].subnum;
  319.     pts=0;
  320.     if (qsc_n[i1/32]&(1L<<(i1%32)))
  321.       pts=1;
  322.     pts=1;
  323.     /* remove pts=1 to search only marked directories */
  324.     if (pts) {
  325.       curdir=i;
  326.       dliscan();
  327.       pty=1;
  328.       for (i1=1; (i1<=numf) && (!abort) && (!hangup); i1++) {
  329.         SETREC(i1);
  330.         read(dlf,(void *)&u,sizeof(uploadsrec));
  331.         if (compare(s,u.filename)) {
  332.           if (pty) {
  333.             printtitle(&abort);
  334.             pty=0;
  335.                 pc=1;
  336.           }
  337.           printinfo(&u,&abort);
  338.           } else if (!empty())
  339.             checka(&abort,&next);
  340.         }
  341.       if ((pc) && (!abort)) {
  342.     if (fc)
  343.       ansic(3);
  344.     if (okansi())
  345.       pla("└──────────────┴───────┴─────────────────────────────────────────────────────┘",&abort);
  346.     else
  347.       pla("+--------------+-------+-----------------------------------------------------+",&abort);
  348.     nl();
  349.     pc=0;
  350.             }
  351.       closedl();
  352.     }
  353.   }
  354.   curdir=ocd;
  355.   if ((num_listed) && (!abort)) {
  356.     nl();
  357.     nl();
  358.     sprintf(s,"%s: %d",get_string(744), num_listed);
  359.     pl(s);
  360.     nl();
  361.   }
  362. }
  363.  
  364. Next, remove or comment out void finddescription(void) and replace with my
  365. routine.....
  366. void finddescription(void)
  367. {
  368.   uploadsrec u;
  369.   int i,i1,i2,abort,pty,d,ocd,pts,pc,fc;
  370.   char s[81],s1[81];
  371.  
  372.   fc=thisuser.sysstatus & sysstatus_funky_colors;
  373.  
  374.   nl();
  375.   nl();
  376.   pl(get_string(793));
  377.   nl();
  378.   pl(get_string(794));
  379.   outstr(":");
  380.   input(s1,51);
  381.   if (s1[0]==0)
  382.     return;
  383.   ocd=curdir;
  384.   abort=0;
  385.   num_listed=0;
  386.   for (i=0; (i<num_dirs) && (!abort) && (!hangup) && (udir[i].subnum!=-1); i++) {
  387.     i1=udir[i].subnum;
  388.     pts=0;
  389.     if (qsc_n[i1/32]&(1L<<(i1%32)))
  390.       pts=1;
  391.     pts=1;
  392.     /* remove pts=1 to search only marked directories */
  393.     if (pts) {
  394.       curdir=i;
  395.       dliscan();
  396.       pty=1;
  397.       for (i1=1; (i1<=numf) && (!abort) && (!hangup); i1++) {
  398.     SETREC(i1);
  399.     read(dlf,(void *)&u,sizeof(uploadsrec));
  400.     strcpy(s,u.description);
  401.     for (i2=0; i2<strlen(s); i2++)
  402.       s[i2]=upcase(s[i2]);
  403.     if (strstr(s,s1)!=NULL) {
  404.       if (pty) {
  405.         printtitle(&abort);
  406.         pty=0;
  407.         pc=1;
  408.       }
  409.       printinfo(&u,&abort);
  410.     }
  411.       }
  412.       if ((pc) && (!abort)) {
  413.     if (fc)
  414.       ansic(3);
  415.     if (okansi())
  416.       pla("└──────────────┴───────┴─────────────────────────────────────────────────────┘",&abort);
  417.     else
  418.       pla("+--------------+-------+-----------------------------------------------------+",&abort);
  419.     nl();
  420.     pc=0;
  421.       }
  422.       closedl();
  423.     }
  424.   }
  425.   curdir=ocd;
  426.   if ((num_listed) && (!abort)) {
  427.     nl();
  428.     nl();
  429.     sprintf(s,"%s;%d",get_string(744),num_listed);
  430.     pl(s);
  431.     nl();
  432.   }
  433. }
  434.  
  435. Ok, we are almost finished.  Here are some small changes you need to
  436. make.  First, go to the begining of the XFER C, and do a SEARCH for
  437. all instances of the number 58.  Change them to number 51.  You can
  438. do this in the BC Editor by hitting Control-Q Control-A, it will
  439. ask for Search string, say 58 and hit return, replace string will be
  440. 51.  Options to use: ug  it will do all the changes for ya.
  441. **    Make Sure that you DO NOT replace the:" get_string(758));" While 
  442.         making these Changes.***
  443. Now, save XFER.C, and load up BBS.C, search for case 'N' in void
  444. dlmainmenu()...  look for:
  445.  
  446. nscandir(curdir,&abort,0);
  447.  
  448. make it say
  449.  
  450. nscandir(curdir,&abort,1);
  451.  
  452. Save that, Hit "F9" to compile your BBS code, and you are all set up
  453. with File Listings Boxed!!
  454. For All your WWIV File Needs, call:
  455. ╔═════════════════════════════════════════════════════════════════════════╗
  456. ║                         The Funny Farm (East)                           ║
  457. ║                                                                         ║
  458. ║                      Head Psychiatrist: Benny Hill                      ║
  459. ║                    Intern Psycho: Gelatinous Citizen                    ║
  460. ║                       Intern Psycho: Kahuna Bambu                       ║
  461. ║                                                                         ║
  462. ║                     WWIVnet @7400   WWIVLink @17400                     ║
  463. ║                            FIDOnet 1:379/15                             ║
  464. ║                  Official WWIV Support Bulletin Board                   ║
  465. ║                        Charlotte, North Carolina                        ║
  466. ║                     (704)554-1496    300/1200/2400                      ║
  467. ║                                                                         ║
  468. ╚═════════════════════════════════════════════════════════════════════════╝
  469.